package com.zj.osm.entity.greendao;

import android.os.Parcel;
import android.os.Parcelable;

import androidx.annotation.NonNull;

import com.zj.osm.entity.db.DaoSession;
import com.zj.osm.entity.db.LineDao;
import com.zj.osm.entity.db.PointDao;

import org.greenrobot.greendao.DaoException;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Index;
import org.greenrobot.greendao.annotation.JoinEntity;
import org.greenrobot.greendao.annotation.ToMany;

import java.util.ArrayList;
import java.util.List;
import com.zj.osm.entity.db.MultimediaDao;
import com.zj.osm.entity.db.EquipmentDao;

/**
 * 点类，和设备一对多，和线多对多，和项目多对一，和多媒体一对多
 *
 * @author jiang zhu on 2019/10/24
 */
@Entity
public class Point implements Parcelable {
    @Id(autoincrement = true)
    private Long id;
    //[杆塔,地形点，设备】
    private String name;
    //地形点和设备以及杆塔的的类型ID（来自与EquipType）
    private int equipType_id;
    //地形点和设备以及杆塔的高陈
    private String high;
    //地形点和设备以及杆塔的状态 old
    private String state;
    //地形点和设备以及杆塔的UID uid
    @Index(unique = true)
    private String pointId;
    //唯一UID
    @Index(unique = true)
    private String uid;
    //地形点和设备以及杆塔 DefaultLineType; DefaultLineType=DefaultLineType->[EquipType里面的DefaultLineType] ###必须
    private String DefaultLineType;
    //地形点和设备以及杆塔的名称编号 ZD-2 ,Z-1 Z-11.... mark=mark->[EquipType里面的code+数字] ###必须
    private String equipName;
    private String mark;//mark和LineType一样的
    //地形点和设备以及杆塔的 名称(直线杆,转角干,公路,河流，相式变)equipType_name=name->[EquipType里面的name] ###必须
    private String equipType_name;//sbbh
    ///地形点和设备以及杆塔的 经度
    private Double longitude;
    //地形点和设备以及杆塔的 纬度
    private Double latitude;
    //地形点和设备以及杆塔的 LegendTypeKey = remark->[EquipType里面的ReMark] ###必须
    private String LegendTypeKey;//lineType
    //地形点和设备以及杆塔的挡据
    private double dangju;
    //点A的经度
    private String latA;
    //点B的经度
    private String latB;
    //点A的纬度
    private String lonA;
    //点B的纬度
    private String lonB;
    //柱上变压器 主杆
    private String main_rod_uid;//lonA
    //柱上变压器 副杆
    private String deputy_rod_uid;//lonB
    //地形点类别 【条状,块状,,,,,】
    private String category;
    //附属设备信息 2019 19 23 作为是否T分支 不能其他用。 是否T分支 如果是  为1 ,主干点 "" 十字接 2
    private String isT;//equ
    //是否为地形点
    private String whether;
    //是否为批量采的点  //0不是批量踩点
    private String batch;
    //设备类型 :【直线杆,换点箱子,河流】
    private String sblx;
    //关联设备
    private String glsb;
    //地形点长度
    private String length;
    //地形点宽度
    private String width;
    //图标
    private String icon;
    //地形点地址
    private String address;
    //高度
    private String equpmentHeight;
    //高差
    private String dipOfhorizon;
    //柱上变压器的主杆的线路方向
    private String lineDirection;
    //项目名称
    /**
     * 项目字段
     * */
    //项目ID
    private Long projectId;
    //备注
    private String note;

    //region湖南
    private String roadName;
    //道路位置
    private String roadAdress;
    //道路性质
    private String roadNature;
    //网格名称
    private String gridName;

    public String getGridName() {
        return gridName;
    }

    public void setGridName(String gridName) {
        this.gridName = gridName;
    }

    //电缆井属性
    private String cabwellPy;
    //电缆井尺寸(米）
    private String dljCC;
    //电缆井资源状态
    private String rsState;
    //规划年
    private String ghYear;
    //资源规格 resourceSpecifications
    private String reSpecfs;

    public String getRoadNature() {
        return roadNature;
    }

    public void setRoadNature(String roadNature) {
        this.roadNature = roadNature;
    }



    public String getReSpecfs() {
        return reSpecfs;
    }

    public void setReSpecfs(String reSpecfs) {
        this.reSpecfs = reSpecfs;
    }

    public String getGhYear() {
        return ghYear;
    }

    public void setGhYear(String ghYear) {
        this.ghYear = ghYear;
    }
//endregion


    public String getRoadName() {
        return roadName;
    }

    public void setRoadName(String roadName) {
        this.roadName = roadName;
    }

    public String getRoadAdress() {
        return roadAdress;
    }

    public void setRoadAdress(String roadAdress) {
        this.roadAdress = roadAdress;
    }

    public String getCabwellPy() {
        return cabwellPy;
    }

    public void setCabwellPy(String cabwellPy) {
        this.cabwellPy = cabwellPy;
    }

    public String getRsState() {
        return rsState;
    }

    public void setRsState(String rsState) {
        this.rsState = rsState;
    }

    public void setEquipmentList(List<Equipment> equipmentList) {
        this.equipmentList = equipmentList;
    }

    public void setMultimediaList(List<Multimedia> multimediaList) {
        this.multimediaList = multimediaList;
    }

    public void setLineList(List<Line> lineList) {
        this.lineList = lineList;
    }

    public DaoSession getDaoSession() {
        return daoSession;
    }

    public void setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
    }

    public PointDao getMyDao() {
        return myDao;
    }

    public void setMyDao(PointDao myDao) {
        this.myDao = myDao;
    }

    public static Creator<Point> getCREATOR() {
        return CREATOR;
    }
//endregion湖南


    //点中的设备
    @ToMany(referencedJoinProperty = "pointId")
    private List<Equipment> equipmentList;

    //点中的设备
    @ToMany(referencedJoinProperty = "pointId")
    private List<Multimedia> multimediaList;

    //点上的线
    @ToMany
    @JoinEntity(entity = PointAndLineBean.class,sourceProperty = "pointId",targetProperty = "lineId")
    private List<Line> lineList;
    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    /** Used for active entity operations. */
    @Generated(hash = 1980395011)
    private transient PointDao myDao;

    public String toString1() {
        return "Point{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", equipType_id=" + equipType_id +
                ", high='" + high + '\'' +
                ", state='" + state + '\'' +
                ", pointId='" + pointId + '\'' +
                ", uid='" + uid + '\'' +
                ", DefaultLineType='" + DefaultLineType + '\'' +
                ", mark='" + mark + '\'' +
                ", equipType_name='" + equipType_name + '\'' +
                ", longitude=" + longitude +
                ", latitude=" + latitude +
                ", LegendTypeKey='" + LegendTypeKey + '\'' +
                ", dangju=" + dangju +
                ", latA='" + latA + '\'' +
                ", latB='" + latB + '\'' +
                ", lonA='" + lonA + '\'' +
                ", lonB='" + lonB + '\'' +
                ", main_rod_uid='" + main_rod_uid + '\'' +
                ", deputy_rod_uid='" + deputy_rod_uid + '\'' +
                ", category='" + category + '\'' +
                ", isT='" + isT + '\'' +
                ", whether='" + whether + '\'' +
                ", batch='" + batch + '\'' +
                ", sblx='" + sblx + '\'' +
                ", glsb='" + glsb + '\'' +
                ", length='" + length + '\'' +
                ", width='" + width + '\'' +
                ", icon='" + icon + '\'' +
                ", address='" + address + '\'' +
                ", equpmentHeight='" + equpmentHeight + '\'' +
                ", dipOfhorizon='" + dipOfhorizon + '\'' +
                ", lineDirection='" + lineDirection + '\'' +
                ", projectId=" + projectId +
                ", note='" + note + '\'' +
                ", equipmentList=" + equipmentList +
                ", multimediaList=" + multimediaList +
                ", lineList=" + lineList +
                ", daoSession=" + daoSession +
                ", myDao=" + myDao +
                '}';
    }

    @Override
    public String toString() {
        return this.mark;
    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getEquipType_id() {
        return this.equipType_id;
    }

    public void setEquipType_id(int equipType_id) {
        this.equipType_id = equipType_id;
    }

    public String getHigh() {
        return this.high;
    }

    public void setHigh(String high) {
        this.high = high;
    }

    public String getState() {
        return this.state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getPointId() {
        return this.pointId;
    }

    public void setPointId(String pointId) {
        this.pointId = pointId;
    }

    public String getUid() {
        return this.uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getDefaultLineType() {
        return this.DefaultLineType;
    }

    public void setDefaultLineType(String DefaultLineType) {
        this.DefaultLineType = DefaultLineType;
    }

    public String getMark() {
        return this.mark;
    }

    public void setMark(String mark) {
        this.mark = mark;
    }

    public String getEquipType_name() {
        return this.equipType_name;
    }

    public void setEquipType_name(String equipType_name) {
        this.equipType_name = equipType_name;
    }

    public Double getLongitude() {
        return this.longitude;
    }

    public void setLongitude(Double longitude) {
        this.longitude = longitude;
    }

    public Double getLatitude() {
        return this.latitude;
    }

    public void setLatitude(Double latitude) {
        this.latitude = latitude;
    }

    public String getLegendTypeKey() {
        return this.LegendTypeKey;
    }

    public void setLegendTypeKey(String LegendTypeKey) {
        this.LegendTypeKey = LegendTypeKey;
    }

    public double getDangju() {
        return this.dangju;
    }

    public void setDangju(double dangju) {
        this.dangju = dangju;
    }

    public String getLatA() {
        return this.latA;
    }
    public String getDljCC() {
        return dljCC;
    }

    public void setDljCC(String dljCC) {
        this.dljCC = dljCC;
    }
    public void setLatA(String latA) {
        this.latA = latA;
    }

    public String getLatB() {
        return this.latB;
    }

    public void setLatB(String latB) {
        this.latB = latB;
    }

    public String getLonA() {
        return this.lonA;
    }

    public void setLonA(String lonA) {
        this.lonA = lonA;
    }

    public String getLonB() {
        return this.lonB;
    }

    public void setLonB(String lonB) {
        this.lonB = lonB;
    }

    public String getMain_rod_uid() {
        return this.main_rod_uid;
    }

    public void setMain_rod_uid(String main_rod_uid) {
        this.main_rod_uid = main_rod_uid;
    }

    public String getDeputy_rod_uid() {
        return this.deputy_rod_uid;
    }

    public void setDeputy_rod_uid(String deputy_rod_uid) {
        this.deputy_rod_uid = deputy_rod_uid;
    }

    public String getCategory() {
        return this.category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getIsT() {
        return this.isT;
    }

    public void setIsT(String isT) {
        this.isT = isT;
    }

    public String getWhether() {
        return this.whether;
    }

    public void setWhether(String whether) {
        this.whether = whether;
    }

    public String getBatch() {
        return this.batch;
    }

    public void setBatch(String batch) {
        this.batch = batch;
    }

    public String getSblx() {
        return this.sblx;
    }

    public void setSblx(String sblx) {
        this.sblx = sblx;
    }

    public String getGlsb() {
        return this.glsb;
    }

    public void setGlsb(String glsb) {
        this.glsb = glsb;
    }

    public String getLength() {
        return this.length;
    }

    public void setLength(String length) {
        this.length = length;
    }

    public String getWidth() {
        return this.width;
    }

    public void setWidth(String width) {
        this.width = width;
    }

    public String getIcon() {
        return this.icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getAddress() {
        return this.address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getEqupmentHeight() {
        return this.equpmentHeight;
    }

    public void setEqupmentHeight(String equpmentHeight) {
        this.equpmentHeight = equpmentHeight;
    }

    public String getDipOfhorizon() {
        return this.dipOfhorizon;
    }

    public void setDipOfhorizon(String dipOfhorizon) {
        this.dipOfhorizon = dipOfhorizon;
    }

    public String getLineDirection() {
        return this.lineDirection;
    }

    public void setLineDirection(String lineDirection) {
        this.lineDirection = lineDirection;
    }

    public Long getProjectId() {
        return this.projectId;
    }

    public void setProjectId(Long projectId) {
        this.projectId = projectId;
    }

    public String getNote() {
        return this.note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    public String getEquipName() {
        return equipName;
    }

    public void setEquipName(String equipName) {
        this.equipName = equipName;
    }
    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
    @Generated(hash = 1237346793)
    public List<Equipment> getEquipmentList() {
        if (equipmentList == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            EquipmentDao targetDao = daoSession.getEquipmentDao();
            List<Equipment> equipmentListNew = targetDao._queryPoint_EquipmentList(id);
            synchronized (this) {
                if (equipmentList == null) {
                    equipmentList = equipmentListNew;
                }
            }
        }
        return equipmentList;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 1882233752)
    public synchronized void resetEquipmentList() {
        equipmentList = null;
    }

    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
    @Generated(hash = 754453438)
    public List<Multimedia> getMultimediaList() {
        if (multimediaList == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            MultimediaDao targetDao = daoSession.getMultimediaDao();
            List<Multimedia> multimediaListNew = targetDao._queryPoint_MultimediaList(id);
            synchronized (this) {
                if (multimediaList == null) {
                    multimediaList = multimediaListNew;
                }
            }
        }
        return multimediaList;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 1028961208)
    public synchronized void resetMultimediaList() {
        multimediaList = null;
    }

    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
    @Generated(hash = 664227868)
    public List<Line> getLineList() {
        if (lineList == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            LineDao targetDao = daoSession.getLineDao();
            List<Line> lineListNew = targetDao._queryPoint_LineList(id);
            synchronized (this) {
                if (lineList == null) {
                    lineList = lineListNew;
                }
            }
        }
        return lineList;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 847648996)
    public synchronized void resetLineList() {
        lineList = null;
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1714415827)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getPointDao() : null;
    }

    public Point() {
    }

    @Generated(hash = 2115871435)
    public Point(Long id, String name, int equipType_id, String high, String state, String pointId,
            String uid, String DefaultLineType, String equipName, String mark, String equipType_name,
            Double longitude, Double latitude, String LegendTypeKey, double dangju, String latA,
            String latB, String lonA, String lonB, String main_rod_uid, String deputy_rod_uid,
            String category, String isT, String whether, String batch, String sblx, String glsb,
            String length, String width, String icon, String address, String equpmentHeight,
            String dipOfhorizon, String lineDirection, Long projectId, String note, String roadName,
            String roadAdress, String roadNature, String gridName, String cabwellPy, String dljCC,
            String rsState, String ghYear, String reSpecfs) {
        this.id = id;
        this.name = name;
        this.equipType_id = equipType_id;
        this.high = high;
        this.state = state;
        this.pointId = pointId;
        this.uid = uid;
        this.DefaultLineType = DefaultLineType;
        this.equipName = equipName;
        this.mark = mark;
        this.equipType_name = equipType_name;
        this.longitude = longitude;
        this.latitude = latitude;
        this.LegendTypeKey = LegendTypeKey;
        this.dangju = dangju;
        this.latA = latA;
        this.latB = latB;
        this.lonA = lonA;
        this.lonB = lonB;
        this.main_rod_uid = main_rod_uid;
        this.deputy_rod_uid = deputy_rod_uid;
        this.category = category;
        this.isT = isT;
        this.whether = whether;
        this.batch = batch;
        this.sblx = sblx;
        this.glsb = glsb;
        this.length = length;
        this.width = width;
        this.icon = icon;
        this.address = address;
        this.equpmentHeight = equpmentHeight;
        this.dipOfhorizon = dipOfhorizon;
        this.lineDirection = lineDirection;
        this.projectId = projectId;
        this.note = note;
        this.roadName = roadName;
        this.roadAdress = roadAdress;
        this.roadNature = roadNature;
        this.gridName = gridName;
        this.cabwellPy = cabwellPy;
        this.dljCC = dljCC;
        this.rsState = rsState;
        this.ghYear = ghYear;
        this.reSpecfs = reSpecfs;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeValue(this.id);
        dest.writeString(this.name);
        dest.writeInt(this.equipType_id);
        dest.writeString(this.high);
        dest.writeString(this.state);
        dest.writeString(this.pointId);
        dest.writeString(this.uid);
        dest.writeString(this.DefaultLineType);
        dest.writeString(this.equipName);
        dest.writeString(this.mark);
        dest.writeString(this.equipType_name);
        dest.writeValue(this.longitude);
        dest.writeValue(this.latitude);
        dest.writeString(this.LegendTypeKey);
        dest.writeDouble(this.dangju);
        dest.writeString(this.latA);
        dest.writeString(this.latB);
        dest.writeString(this.lonA);
        dest.writeString(this.lonB);
        dest.writeString(this.main_rod_uid);
        dest.writeString(this.deputy_rod_uid);
        dest.writeString(this.category);
        dest.writeString(this.isT);
        dest.writeString(this.whether);
        dest.writeString(this.batch);
        dest.writeString(this.sblx);
        dest.writeString(this.glsb);
        dest.writeString(this.length);
        dest.writeString(this.width);
        dest.writeString(this.icon);
        dest.writeString(this.address);
        dest.writeString(this.equpmentHeight);
        dest.writeString(this.dipOfhorizon);
        dest.writeString(this.lineDirection);
        dest.writeValue(this.projectId);
        dest.writeString(this.note);
        dest.writeString(this.roadName);
        dest.writeString(this.roadAdress);
        dest.writeString(this.roadNature);
        dest.writeString(this.gridName);
        dest.writeString(this.cabwellPy);
        dest.writeString(this.rsState);
        dest.writeString(this.ghYear);
        dest.writeString(this.reSpecfs);
        dest.writeTypedList(this.equipmentList);
        dest.writeList(this.multimediaList);
        dest.writeTypedList(this.lineList);
    }

    protected Point(Parcel in) {
        this.id = (Long) in.readValue(Long.class.getClassLoader());
        this.name = in.readString();
        this.equipType_id = in.readInt();
        this.high = in.readString();
        this.state = in.readString();
        this.pointId = in.readString();
        this.uid = in.readString();
        this.DefaultLineType = in.readString();
        this.equipName = in.readString();
        this.mark = in.readString();
        this.equipType_name = in.readString();
        this.longitude = (Double) in.readValue(Double.class.getClassLoader());
        this.latitude = (Double) in.readValue(Double.class.getClassLoader());
        this.LegendTypeKey = in.readString();
        this.dangju = in.readDouble();
        this.latA = in.readString();
        this.latB = in.readString();
        this.lonA = in.readString();
        this.lonB = in.readString();
        this.main_rod_uid = in.readString();
        this.deputy_rod_uid = in.readString();
        this.category = in.readString();
        this.isT = in.readString();
        this.whether = in.readString();
        this.batch = in.readString();
        this.sblx = in.readString();
        this.glsb = in.readString();
        this.length = in.readString();
        this.width = in.readString();
        this.icon = in.readString();
        this.address = in.readString();
        this.equpmentHeight = in.readString();
        this.dipOfhorizon = in.readString();
        this.lineDirection = in.readString();
        this.projectId = (Long) in.readValue(Long.class.getClassLoader());
        this.note = in.readString();
        this.roadName = in.readString();
        this.roadAdress = in.readString();
        this.roadNature = in.readString();
        this.gridName = in.readString();
        this.cabwellPy = in.readString();
        this.rsState = in.readString();
        this.ghYear = in.readString();
        this.reSpecfs = in.readString();
        this.equipmentList = in.createTypedArrayList(Equipment.CREATOR);
        this.multimediaList = new ArrayList<Multimedia>();
        in.readList(this.multimediaList, Multimedia.class.getClassLoader());
        this.lineList = in.createTypedArrayList(Line.CREATOR);
    }

    public static final Creator<Point> CREATOR = new Creator<Point>() {
        @Override
        public Point createFromParcel(Parcel source) {
            return new Point(source);
        }

        @Override
        public Point[] newArray(int size) {
            return new Point[size];
        }
    };
}
